<!DOCTYPE html>
<html lang="en">
<link rel="stylesheet" href="lib/layui/css/layui.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/vue.js"></script>
<script src="js/axios.js"></script>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
<table class="layui-table">
    <colgroup>
        <col width="7%">
        <col width="7%">
        <col width="7%">
        <col width="7%">
        <col width="7%">
        <col width="7%">
        <col width="7%">
        <col width="7%">
        <col width="7%">
        <col width="7%">
        <col width="7%">
        <col width="7%">
        <col width="7%">
        <col width="7%">

    </colgroup>
    <thead>
    <tr>
        <th>流水号</th>
        <th>交易时间</th>
        <th>转账类型</th>
        <th>转出账号</th>
        <th>用户名</th>
        <th>转出银行</th>
        <th>转入账号</th>
        <th>转入用户</th>
        <th>转入银行</th>
        <th>货币类型</th>
        <th>转账金额</th>
        <th>交易类型</th>
        <th>描述</th>
        <th>转账状态</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <tr v-for="(item,i) in transfer.transfers">
        <td>{{item.dealno}}</td>
        <td>{{item.dealdate}}</td>
        <td><!--{{item.transtype}}-->
            <span v-if="item.transtype==0">行内转账</span>
            <span v-else-if="item.transtype==1">跨行转账</span>
        </td>
        <td>{{item.accout}}</td>
        <td>{{item.accoutname}}</td>
        <td>{{item.accoutbank}}</td>
        <td>{{item.accin}}</td>
        <td>{{item.accinname}}</td>
        <td>{{item.accinbank}}</td>
        <td>{{item.currtype}}</td>
        <td>{{item.transfund}}</td>
        <td>{{item.kind}}</td>
        <td>{{item.descriptions}}</td>
        <td><!--{{item.transstatus}}-->
            <span v-if="item.transstatus==0">成功</span>
            <span v-else-if="item.transstatus==1">实时</span>
            <span v-else-if="item.transstatus==3">次日</span>
            <span v-else-if="item.transstatus==4">处理中</span>
            <span v-else-if="item.transstatus==5">失败</span>
            <span v-else-if="item.transstatus==6">网络问题</span>
        </td>
        <td>
            <span v-if="item.transstatus == 6"><button type="button" class="layui-btn layui-btn-danger  layui-btn-xs" v-on:click="goRetry(i)">重新发送</button></span>
            <span v-else><button type="button"class="layui-btn layui-btn-disabled  layui-btn-xs">重新发送</button></span>
        </td>
    </tr>

    </tbody>
</table>
    <button class="layui-btn layui-btn-radius"   v-on:click="prevPage">上一页</button>
    <span style="font-size: 20px">当前{{page.index}}</span>|<span style="font-size: 20px">共{{transfer.pageCount}}</span>
    <button class="layui-btn layui-btn-radius"  v-on:click="nextPage">下一页</button>
</div>
</body>
<script>
    var app = new Vue({
        el:"#app",
        data:{
            page:{
                index:1,
                pageSize:10,
                condition:"",
                start:null,
                end:null,
                status:null
            },
            transfer:{},
            vo:{
                accNo:"",
                username:"",
                userCertNo:"",
                toBankCode:"",
                toAccNo:"",
                toAccName:"",
                accMoney:0,
                transStatus:0,
                description:""
            }


        },
        mounted:function () {
            this.getTransferInfo();
        },
        methods:{
            getTransferInfo:function () {
                var that = this;
                axios.post("/transfer/find",that.page).then(function (res) {
                    that.transfer = res.data.t;

                })
            },
            goRetry:function (i) {
                this.vo.accNo = this.transfer.transfers[i].dealno;
                this.vo.username = this.transfer.transfers[i].accoutname;
                this.vo.toBankCode = this.transfer.transfers[i].accinbank;
                this.vo.toAccNo = this.transfer.transfers[i].accin;
                this.vo.toAccName = this.transfer.transfers[i].accinname;
                this.vo.accMoney = this.transfer.transfers[i].transfund;

                var that = this;
                axios.post("/transfer/modify",that.vo).then(function (res) {
                    console.log(res)
                    that.getTransferInfo();
                })
            },
            prevPage:function () {
                if(this.page.index>1){
                    this.page.index--;
                    that.getTransferInfo();
                }

            },
            nextPage:function () {
                console.log(this.page.index)
                console.log(this.log.pageCount)
                if (this.page.index<this.transfer.pageCount) {
                    this.page.index++;
                    that.getTransferInfo();
                }
            }
        }
    })
</script>
</html>
<script src="js/jquery-3.4.1.min.js"></script>
<script src="lib/layui/layui.js"></script>
<script src="js/admin.js"></script>